package com.fqgj.sentry.policy.enums;

/**
 * Created with IntelliJ IDEA.
 * User: yujianfu (mr.vencnet@gmail.com)
 * Date: 2017/7/19
 * Time: 下午5:23
 */
public enum RuleTypeEnum {
    all(0,"全部"),
    custom(1, "自定义"),
    other(2, "公用规则");

    private int type;
    private String desc;


    RuleTypeEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public RuleTypeEnum setType(int type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public RuleTypeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static RuleTypeEnum getEnumByType(int type) {
        RuleTypeEnum ruleTypeEnum = null;
        for (RuleTypeEnum e : RuleTypeEnum.values()) {
            if (e.getType() == type) {
                return e;
            }
        }
        return ruleTypeEnum;
    }
}
